<?php include('./templete/public/head.php') ?>
<body>

<!--搜索-->
<div class="comm-search">
    <div class="search-input">
        <i class="iconfont icon-sousuo"></i>
        <input type="text" name="" id="title" value="<?php echo input('title') ?>" placeholder="请输入您要搜索的攻略"  onchange="search()"/>
    </div>
</div>
<!--搜索标签-->
<div class="search-tag">
    <div class="tag1">
        <a href="<?php echo url('travel/mate',['query_type'=>1])?>" <?php if($query_type==1){echo 'class="active"';}?>>所有活动</a>
        <a href="<?php echo url('travel/mate',['query_type'=>2])?>" <?php if($query_type==2){echo 'class="active"';}?>>我发起的活动</a>
        <a href="<?php echo url('travel/mate',['query_type'=>3])?>" <?php if($query_type==3){echo 'class="active"';}?>>我报名的活动</a>
        <a href="<?php echo url('travel/publish_mate')?>">发起活动</a>
    </div>
</div>
<hr class="bgcolor"/>

<!--所有攻略-->
<div class="index-main all-strategy">
    <div class="main-content strategy-content">

        <div class="c-list">
    </div>
</div>
</div>
</body>

</html>
<script>
    get_mate_list();
    function get_mate_list() {
        $.ajax({
            url:"<?php echo url('travel/get_mate_list')?>",
            data:{
                query_type:<?php echo $query_type?>,
            },
            success:function (data) {
                $('.c-list').html(data);
            }
        })
    }

    //获取更多评论
    $(function() {
        var page = 2;
        var load_flag = true;
        $(window).scroll(function() {
            var totalheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop());
            var documentheight = parseFloat($(document).height());
            if (documentheight - totalheight <= 200) {
                $("#loadmore").show();
                if(load_flag){
                    load_flag=!load_flag;
                    $.ajax({
                        url: '<?php echo url('travel/get_mate_list')?>',
                        type: 'post',
                        dataType: 'json',
                        data: {
                            page:page,
                            query_type:<?php echo $query_type?>,
                            title:$('#title').val(),
                        },
                        success: function(data) {
                            if (data) {
                                $('.c-list').append(data);
                                load_flag=!load_flag;
                                page++;
                            }
                        }
                    })
                }
            }
        });
    });
</script>